<template>
  <div class="tabdetial">
    <Nav></Nav>
    <div class="banner-wrap">
      <img class="banner" :src="tabdetailBg" />
      <!-- <div class="btn">点击查看</div> -->
    </div>
    <div class="wrap">

     <div class="tab">
        <span class="line"></span>
        <span>资讯中心</span>
        <span>{{type == 1 ? '三位一体' : type == 2 ? '强基计划' :  type == 3 ? '浙江新高考' : '高职提前批' }}</span>
      </div>

    <div class="introduce-wrap">
    <div
        class="introduce-wrap-item"
        v-for="(item, index) in info"
        @click="gotoSchool(item.id)"
        :key="item.name"
    >
        <consultationProject
        :changeFlag="false"
        :index="index"
        :introduce="item"
        :readMore="false"
        ></consultationProject>
    </div>
    </div>

      <div class="page">
        <van-pagination
            v-model="currentPage"
            @change="changePage"
            :total-items="total"
            force-ellipses
            />
    </div>



    </div>

    

    <Footer></Footer>
  </div>
</template>

<script setup>
import Footer from '../../components/pc/Footer.vue';
import Nav from '../../components/pc/nav.vue';
import consultationProject from '../../components/pc/consultationProject.vue';
import { onMounted, ref } from 'vue';
import { useRoute,useRouter } from 'vue-router';
import { getArticleListPc } from '../../api/apiList/pcApi.js';
import tabdetailBg from '../../assets/pc/zixun-bg.png';
let info = ref({});
let currentIndex = ref(-1);
const route = useRoute();
//分页参数
const currentPage = ref(2)
let total = ref('')
let limit = ref(9)
const id = route.query.id;
const type = route.query.type;
onMounted(() => {
  initList()

});
const changePage = () => {
  initList()
};
const initList = async ()=>{
   // 获取列表数据
  await getArticleListPc({type:id,page: currentPage.value,limit: 9}).then((res) => {
    const { result } = res;
    total.value = result.length;
    info.value = []
    info.value = result.slice(limit.value * (currentPage.value - 1),limit.value * (currentPage.value - 1) + (limit.value));
  });
  

}

</script>

<style lang="less" scoped>
.tabdetial {
   .page {
        display: flex;
        align-items: flex-end;
        justify-content:flex-end;
    }
  .wrap {
    position: relative;
    width: 1201Px;
    margin: 0 auto;
    .btn {
      position: absolute;
      left: 289Px;
      top: -110Px;
      text-align: center;
      line-height: 60Px;
      width: 293Px;
      height: 60Px;
      background: #ffffff;
      border-radius: 40Px;
      font-size: 32Px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #666666;
    }
  }
  .banner-wrap {
    display: flex;
    justify-content: center;
    width: 100vw;
  }
  .banner {
    width: 1200Px;
    height: 92Px;
    margin-top: 29Px;
    margin-bottom: 29Px;
   
  }
  .tab {
    font-size: 23Px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #000;
    line-height: 40Px;
    margin-bottom: 30Px;
    display: flex;
    align-items: center;
    .line {
        width: 3Px;
        height: 20Px;
        background: linear-gradient(140deg, #011a35 0%, #000000 100%);
    }
    span {
      display: inline-block;
      margin-right: 20Px;
    }
  }

.introduce-wrap {
    margin-top: 15Px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
}
</style>
